package com.woniuxy.threadmethods;

import com.woniuxy.untis.Sleep;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.LockSupport;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO: interrupted 会清除标记
 * <P> Date: 2022/4/6:19:03
 * <P> Description:
 */
@Slf4j(topic = "c.Test16")
public class Test16 {
    static Object object = new Object();

    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            log.debug("洗水壶");
            Sleep.sleep(1);
            log.debug("烧开水");
            Sleep.sleep(5);
        }, "老王");

        Thread t2 = new Thread(() -> {
            log.debug("洗茶壶");
            Sleep.sleep(1);

            log.debug("洗茶杯");
            Sleep.sleep(2);

            log.debug("拿茶叶");
            Sleep.sleep(1);

            try {
                t1.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("泡茶");
            Sleep.sleep(1);
        },"小王");


        t1.start();
        t2.start();
    }
}

